﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include "GmUiInplaceEdit.h"
#include "OwnerPtr.h"
#include "ElementId.h"
#include <string>

namespace gcmp
{
    class IDocument;
    class IModelView;
    class InplaceEditSharedContent;
    class InplaceEditSharedViewContent;
    class InplaceEditSharedModelViewInfo;
    class EditFamilySharedContent;
}

class GM_UI_INPLACE_EDIT_EXPORT ComponentEditProjectState
{
private:
    ComponentEditProjectState();

public:
    ~ComponentEditProjectState();
    static ComponentEditProjectState* Get();

public:
    void SetInplaceEditSharedContent(gcmp::OwnerPtr<gcmp::InplaceEditSharedContent> opSharedContent);
    gcmp::InplaceEditSharedContent* GetInplaceEditSharedContent();

    void SetEditFamilySharedContent(gcmp::OwnerPtr<gcmp::EditFamilySharedContent> opSharedContent);
    gcmp::EditFamilySharedContent* GetEditFamilySharedContent();

    void SetWorkLevelId(gcmp::ElementId workLevelId);
    gcmp::ElementId GetWorkLevelId();

    void SetIsCreating(bool isCreating);
    bool GetIsCreating();

    void SetFamilyPort(uint16_t port);
    uint16_t GetFamilyPort();

private:
    // 在位编辑数据
    gcmp::OwnerPtr<gcmp::InplaceEditSharedContent> m_opInplaceEditSharedContent;
    // 记录从对话框中选择的工作楼层，用于创建实例时的定位
    gcmp::ElementId m_selectedWorkLevelId;
    // 判断当前是在创建构件还是编辑构件
    bool m_isCreating;
    // 记录族App的端口号
    uint16_t m_familyAppPort;
    gcmp::OwnerPtr<gcmp::EditFamilySharedContent> m_opEditFamilySharedContent;
};
